import { request } from "@umijs/max";
import * as API from "@/services";
export async function queryAreas(params: API.AreaPageQueryParams): Promise<API.RespPageResult<API.Area>> {
    return request('/api/v1/area', {
        params,
    });
}

export async function queryAreaChildren(bizId: string): Promise<API.RespListResult<API.Area>> {
    return request(`/api/v1/area/${bizId}/children`);
}

export async function queryAreaParentsSiblingsTree(params: API.AreaTreeQueryParams, opts?: API.AxiosRequestOpts): Promise<API.RespListResult<API.Area_TreeNode>> {
    return request('/api/v1/area/parents-siblings-tree', {
        params,
        ...(opts || {}),
    });
}

export async function queryArea(bizId: string): Promise<API.RespResult<API.Area>> {
    return request(`/api/v1/area/${bizId}`);
}
